﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Diagnostics;

namespace aaaSoft.SkinEngine
{
    class MyMessageFilter : IMessageFilter
    {
        public bool PreFilterMessage(ref Message m)
        {
            if (m.Msg == SkinHelpers.UnsafeNativeMethods.NativeMethods.WM_PAINT)
            {
                Control ctl = Control.FromHandle(m.HWnd);
                if (ctl != null)
                {
                    if (ctl is ProgressBar)
                    {
                        Graphics g = ctl.CreateGraphics();
                        g.FillRectangle(Brushes.Red, new Rectangle(0, 0, 20, 20));
                    }
                }
            }
            return false;
        }
    }
}
